#ifndef xpack_eowz_increase_value
#define xpack_eowz_increase_value
#pragma push_macro("xuser")
#undef  xuser
#define xuser mixc::eowz_increase_value::inc
#include"define/base_type.hpp"
#include"macro/xexport.hpp"
#include"instruction/count_of_set.hpp"
#include"instruction/count_of_reset.hpp"
#pragma pop_macro("xuser")

namespace mixc::eowz_increase_value::origin{
    template<class item_t>
    struct increase_value{
    private:
        item_t m_value = item_t(-1);
    public:
        operator uxx(){
            return inc::count_of_reset(m_value);
        }

        bstate_t increase(){
            if (m_value == 0){
                return bstate_t::fail;
            }
            else{
                m_value       <<= 1;
                return bstate_t::success;
            }
        }

        bstate_t increase(uxx value){
            if (auto curr = inc::count_of_set(value); curr < value){
                return bstate_t::fail;
            }
            else{
                m_value       <<= value;
                return bstate_t::success;
            }
        }
    };
}

#endif

xexport_spacex(eowz, mixc::eowz_increase_value::origin)
